import { defineStore } from "pinia";

// 全局 loading 的 store
export const useLoadingStore = defineStore("loading", {
    state: () => ({
        visible: false,
        instance: null,
    }),
    getters: {
        opereateOptions: (state) => ({
            visible: state.visible,
            instance: state.instance,
        }),
    },
    actions: {
        setOperateOption({ visible = false, instance = null }) {
            this.$patch({ visible, instance });
        },
    },
});

export const useImageType = defineStore("imageType", {
    state: () => ({
        imageType: [
            "image/gif",
            "image/jpeg",
            "image/jpg",
            "image/pjpeg",
            "image/x-png",
            "image/png",
        ],
    }),
});
